package strategy;

import com.example.paperselection.Paper;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class RandomSelectionStrategy implements PaperSelectionStrategy {
    @Override
    public List<Paper> select(List<Paper> availablePapers, int q) {
        List<Paper> result = new ArrayList<>();
        if (q <= 0 || q > availablePapers.size()) {
            return result;
        }
        List<Paper> shuffledList = new ArrayList<>(availablePapers);
        Collections.shuffle(shuffledList);
        for (int i = 0; i < q && i < shuffledList.size(); i++) {
            result.add(shuffledList.get(i));
        }
        return result;
    }
}
